Top 10k strings from MC Tutor (1985)(Hansoft)(Part 2 of 5).z80 in <root> / bin / z80 / software / Sinclair Spectrum Collection TOSEC.exe / Sinclair ZX Spectrum - Utilities & Educational / Sinclair ZX Spectrum - Utilities & Educational - [Z80] (TOSEC-v2007-01-01) /

Back to the directory listing

   4   LD (HL),C
   3 DEFM "  ADD HL,HL
   3   LD (HL),L
   3   LD (DE),A
   3   ADD HL,HL
   2 the number
   2 DEFM "  RET
   2   SBC HL,DE
   2   SBC HL,BC
   2   LD HL,STORE
   2   LD A,(DE)
   2   LD (22529),A
   2   LD (22528),A
   1 transfer (HL) to (DE), increment HL and DE, decrement BC, set PV flag if BC=0
   1 transfer (HL) to (DE), decrement HL, DE, and BC, set PV flag if BC=0
   1 the port whose number is in C
   1 the memory location (IY)
   1 the memory location (IX)
   1 the memory location (DE)
   1 the memory location (BC)
   1 the location (HL)
   1 the contents of the Accumulator is eXclusively ORed with
   1 the contents of
   1 the computer is HALTed until an interrupt comes to awake it again
   1 the carry flag is set, ie Set Carry Flag
   1 the carry flag is inverted, ie Compliment Carry Flag
   1 the alternative AF registers
   1 the accumulator is ComPared with
   1 the Stack Pointer
   1 the Refresh register
   1 the RETurn address is POPped from the stack
   1 the L register
   1 the Interrupt vector register
   1 the IY register
   1 the IX register
   1 the HL register
   1 the H register
   1 the Flag register
   1 the E register
   1 the DE register
   1 the D register
   1 the C register
   1 the BC, DE, HL registers are all EXchanged with the alternative set
   1 the BC register
   1 the B register
   1 the Accumulator is logically ORed with
   1 the Accumulator is logically ANDed with
   1 the Accumulator is NEGated, ie made negative
   1 the Accumulator
   1 the AF registers
   1 search from (HL) Incrementing BC bytes for data in Accumulator
   1 search from (HL) Decrementing BC bytes for data in Accumulator
   1 rotate the accumulator and carry Right
   1 rotate the Accumulator and carry Left
   1 rotate the Accumulator Right, shifting bit 0 into Carry
   1 rotate the Accumulator Left shifting bit 7 into Carry
   1 rotate Right Decimal contents of (HL) with least significant end of Accumulator
   1 rotate Left Decimal contents of (HL) with least significant end of Accumulator
   1 reSTart at address
   1 r single register
   1 push the return address to stack and CALL
   1 port with the above number
   1 perform relative jump to
   1 perform jump to
   1 output from (HL) to port (C) increment HL, decrement B
   1 ouTput to port (C), from block from (HL) Decrementing HL for B bytes
   1 ouTput from (HL) to port (C) block from (HL) Incrementing for B bytes
   1 oUTput from (HL) to port (C) Decrement HL, decrement B
   1 memory location
   1 location (IY+offset)
   1 location (IX+offset)
   1 is loaded with
   1 is Shifted Right Logically, 0 is shifted into bit 7
   1 is Shifted Right Arithmetically, sign bit unchanged
   1 is Shifted Left Arithmetically, 0 is shifted into bit 0
   1 is Rotated Right, shifting bit 0 into Carry
   1 is Rotated Left shifting bit 7 into Carry
   1 is PUSHed onto the stack and the SP decremented by 2
   1 is POPped from the stack and the SP incremented by 2
   1 is INCremented by 1
   1 is EXchanged with
   1 is DECremented by 1
   1 invert all bits in A register, ie ComPLiment
   1 instruction
   1 input data from
   1 if the Zero flag is set,
   1 if the Zero flag is not set,
   1 if the Sign flag is set, ie Minus,
   1 if the Sign flag is not set, ie Positive,
   1 if the Parity flag is sEt, ie Parity is Even,
   1 if the Parity flag is nOt set, ie Parity is Odd,
   1 if the Carry flag is set,
   1 if the Carry flag is not set,
   1 iNput into (HL) from port (C) increment HL, decrement B
   1 iNput into (HL) from port (C) Decrement HL, decrement B
   1 iNput from port (C), into block from (HL) Incrementing HL for B bytes
   1 iNput from port (C), into block from (HL) Decrementing HL for B bytes
   1 has taken from it the carry and
   1 has added to it the carry and
   1 has added to it
   1 enable Interrupts. NOT PERFORMED BY SIMULATOR.
   1 disable Interrupts. NOT PERFORMED BY SIMULATOR.
   1 decrement B, if zero continue, if Not Zero perform relative jump to
   1 decimal Adjust Accumulator
   1 compare (HL) with A, increment HL, decrement BC
   1 compare (HL) with A, decrement HL, and BC
   1 change Interrupt Mode to
   1 block transfer (BC) bytes starting at (HL) to (DE) incrementing
   1 block transfer (BC) bytes starting at (HL) to (DE) decrementing
   1 and Carry are rotated Left
   1 and Carry are Rotated Right
   1 There   are    no  double   register   SUBinstructions.
   1 The Accumulator has subtracted from it
   1 Space missing
   1 SUB (HL)  )
   1 SBC HL,BC )  SuBtract from HL  with  carrySBC HL,DE )
   1 SBC A,r   )  SuBtract from A  with   carrySBC A,(HL))
   1 SBC A,n   )
   1 S7:DEFM "    EXAMPLE OF REGISTER PAIR ADDITION
   1 S6:DEFM "   EXAMPLES OF SINGLE REGISTER ADDITION
   1 RETurn from Non-maskable interrupt: NOT PERFORMED BY SIMULATOR
   1 RETurn from Interrupt: NOT PERFORMED BY SIMULATOR
   1 P8:DEFM " We  can  therefore load a  register  pair"
   1 Offset too big
   1 Offset missing
   1 Number too large
   1 Number missing
   1 No OPeration is performed, inspite of this it takes .
   1 No DEFB, or DEFW
   1 NOT DEFINED
   1 Missing space or ,
   1 Label too long
   1 Label not found
   1 LD r,(HL)  where r is any single register
   1 LD dd,nn    where dd is any register pair
   1 LD dd,(nn)
   1 LD A,(nn)   where nn is a number 0 - 65535
   1 LD (nn),dd
   1 Instruction unknown
   1 FLAGS$    Registers and Contents   % STAC
   1 Error after inst.
   1 EX5B:DEFM " LD HL,(STORE)
   1 EX5A:DEFM " LD DE,8740
   1 DEFM "with  the  contents of a  pair  of  memory"
   1 DEFM "using addition to successively multiply by"
   1 DEFM "together numbers of any length.
   1 DEFM "to the  non-valid  instructions  LD E,(nn)"
   1 DEFM "the Lower address.
   1 DEFM "the  form  LD r,r'  are  usually  used  to"
   1 DEFM "the  Low byte is held in the location with"
   1 DEFM "results  can  be  displayed  easily.  This"
   1 DEFM "register addition only.  The double length"
   1 DEFM "register  pairs   with  the  contents   of"
   1 DEFM "register  pair  into  a  pair  of   memory"
   1 DEFM "register  pair  addition, as well, to  add"
   1 DEFM "numbers are held in BC and DE so that  the"
   1 DEFM "numbers   8740  and  1260   using   single"
   1 DEFM "number held in the HL register pair by  10"
   1 DEFM "method of addition can be performed  using"
   1 DEFM "locations,   i.e.   LD (nn),BC   which  is"
   1 DEFM "locations,    with    instructions    like"
   1 DEFM "instructions  LD (nn),C  and  LD (nn+1),B."
   1 DEFM "equivalent    to    the    two   non-valid"
   1 DEFM "displayed to the left of the registers.
   1 DEFM "another register pair. Two instructions in"
   1 DEFM "and  LD D,(nn+1).
   1 DEFM "LD DE,(nn). This instruction is equivalent"
   1 DEFM " This  example  effectively  multiplies  a"
   1 DEFM " There   are  no   instructions  to   load"
   1 DEFM " The  state  of  the  individual flags are"
   1 DEFM " The   example  adds   together   the  two"
   1 DEFM " Similarly,  we can load the contents of a"
   1 DEFM " STORE DEFB 25
   1 DEFM " LOW   DEFB 20
   1 DEFM " HIGH  DEFB 125
   1 DEFM "  LD HL,STORE
   1 DEFM "  LD DE,(STORE)
   1 DEFM "  LD C,A
   1 DEFM "  LD BC,32021
   1 DEFM "  LD BC,1260
   1 DEFM "  LD B,A
   1 DEFM "  LD A,E
   1 DEFM "  LD A,D
   1 DEFM "  LD A,15
   1 DEFM "  LD (STORE),HL
   1 DEFM "  LD (HL),0
   1 DEFM "  LD (DE),A
   1 DEFM "  LD (BC),A
   1 DEFM "  ADD HL,DE
   1 DEFM "  ADD A,C
   1 DEFM "  ADD A,(HL)
   1 DEFM "  ADC A,B
   1 Cursor keys, delete,  and auto-repeat are as standard. BREAK returns you to menu.
   1 Can only ADD IX/IY
   1 CP (HL)  Compares A with memory location
   1 Bracket missing
   1 All   configurations of  ADC  instructionscan  be  used  with SBC or  SuBtract  withCarry  instructions.   The  operation   issimilar to SUB,  except that the result isdecremented  by  one if the carry flag  isset.
   1 ADDRESS MACHINE CODE
   1 ADD A,r    where  r  is  any   single
   1 ADD A,n    where n is a number 0 - 255
   1 ADD A,(HL)
   1 ADC A,(HL)
   1 01 seconds to do it
   1 /^3^7^D^Q^^^e^o^v^
   1 .  Conventionally"
   1  where r and r' are any of  the
   1  where n is a number 0 - 255
   1  nn  is a number 0 - 65535
   1  n/v    instruction not valid
   1  following: A,B,C,D,E,H and L. 
   1  exchanges register contents
   1  dd   double register* flag affected
   1  You are trying to run code in allocated storage area. RET missing? Please EDIT 
   1  You are about to write to memory which   will affect your program. Please edit it.
   1  You are about to affect memory area not  allocated to you. Please edit program.   
   1  You  may go  through  the example as manytimes  as you like, until  you  understandit. If  you  still find  difficulty, pressBREAK, skip  over the lessons and re-ENTERthe  lesson  with  which  you  are  havingdifficulty. The  manual  however  gives anoutline of each lesson.
   1  While running this example try to predictthe  state  of  the  Zero  flag  after theinstruction has been performed.
   1  When you do understand the examples giventry  modifying  them   using  the  editor.Then try entering your own programs.   Allprograms should end with RET ( or return).Don't worry if you forget,  the  simulatorwill tell you.
   1  We  can also load a memory location  withthe  contents  of  the  Accumulator   withLD (nn),A   where  nn  is  the  number  oraddress of the memory location.
   1  We  can  therefore load a  register  pairwith  the  contents of a  pair  of  memorylocations,    with    instructions    likeLD DE,(nn). This instruction is equivalentto the  non-valid  instructions  LD E,(nn)and  LD D,(nn+1).
   1  We  can  load any of the  register  pairswith a  number between  0 - 65535 directlyusing instructions like LD HL,nn.
   1  We  can  also load any of  the  registerswith  a  number,  n, between  0  and   255directly, with instructions like LD C,123.We  shall  discuss later  from  where  thenumber  is copied. Suffice to say, at thisstage,  that  instructions are  stored  asnumbers.  For  example LD A,B is stored as78. Look up in Appendix A of your SpectrumManual  LD A,B  and the  number  78.  Someinstructions like LD A,B are stored as onenumber, others take up to four.
   1  Use  of  the  BC  and  DE  registers  forindirect  addressing is limited to  the  Aregister.  i.e. LD (DE),A ; LD A,(BC) etc.
   1  Up to now we have only used  instructionsin   which  memory  locations  have   beenspecified  directly  in  the  instruction.Another  useful  method  of  specifying  amemory location is to use a number held ina   register  pair,   known  as   indirectaddressing.  The instruction LD B,(HL) forexample allows us to load or copy to the Bregister   the  contents  of   the  memorylocation   whose  address  is  in  the  HLregister pair.
   1  Try to predict the state of the Zero  andCarry   flags   before    performing   thecomparison. In the next lessons we will beusing these  flags extensively, to producemore interesting examples.
   1  This  example  subtracts  1260  from 8740using  only  single  register subtraction.The  two  numbers  are  held in  allocatedmemory locations this time.
   1  This  example  effectively  multiplies  anumber held in the HL register pair by  10using addition to successively multiply by2.
   1  This   method   of   subtraction  can  beextended to any length number and registerpair subtraction.
   1  These  instructions  are  primarily  usedwhere counters are required. The operationon register  pairs   is also  useful    insequential operations on memory  locationsutilising indirect addressing.
   1  These   examples   illustrate    indirectaddressing. At this stage it is impossibleto  demonstrate  its  usefulness.   It  isemployed extensive in later examples
   1  There are too many registers called up,  to display. Program will RUN as normal. 
   1  There  is  one   instruction  similar  tothis  type:  EX DE,HL.   It  EXchanges thecontents of the DE  register pair with thecontents of the HL register pair.
   1  The two registers hold different parts ofa number.  Consider the decimal number 27.We  can think of this as having two parts;the high part ( or byte) is the 2 since itrepresents 2*10, the low part (or byte) isthe 7,  since it only represents 7*1.  Thetotal  number is  2*10+7*1=27.  Each digitcan  only  be  0 - 9   i.e.  10  differentnumbers.
   1  The step by step instructions making up aprogram are stored in memory,  a series ofsimilar  registers  or  memory  locations,external  to  the Z80 chip.  65536  memorylocations  can  be  accessed.   They   aredesignated  by their number between 0  and65535.  It  takes the Z80 longer to accessmemory than its own internal registers.
   1  The stack pointer is outside allocated   memory area. Please edit program.
   1  The simulator will  display the  contentsof this  memory  location, in decimal,  inthe second column.
   1  The program has been completed. You may  EDIT or reRUN. Exit by pressing BREAK.   
   1  The last arithmetic instructions  to   bediscussed can be performed on any   singleor  double register(s).  These are INC andDEC.  INC  increments (or  increases)  thecontents   of  the  register,   or  memorylocation indirectly  addressed by  the  HLregister pair,  by one. DEC decrements (ordecreases ) the contents of the  register,or memory location indirectly addressed bythe HL register pair, by one.
   1  The fact that a single register can  onlyhold  numbers  up  to 255  and  the  totalmemory  available  is up to  65535,  is  alimitation.  For  this reason there are  awhole set of instructions on the Z80  thatdeal with  registers in pairs.  The  pairsare BC, DE, and HL register pairs.
   1  The assembler, that converts instructionsinto  machine  code, will  accept  Labels.Instead  of  putting  an  address into theprogram,  we  can  give  it  a  name.  Theassembler  will  then  allocate  a  memorylocation to it. The name must be called upin the program with its initial  conditionusing  the instruction  DEFB, DEFine Byte.
   1  The  zero flag, like the carry flag,   isunaffected by any LD or EX instructions.
   1  The  two types of instructions  discussed( LD r,r' and  LD r,n ) can involve any ofthe  registers  considered.   Only  the  Aregister  can be loaded with the  contentsof a memory location.  The instruction  ofthe general form LD A,(nn) loads or copiesthe   contents   of   memory  location  nn( a number between 0 and 65535 )  into theA register.
   1  The  state  of  the  individual flags aredisplayed to the left of the registers.
   1  The  examples that follow use the  colouras  well as  labels, so expect some colourchanges.
   1  The  example  illustrates  each  type  ofinstruction that loads register pairs.  Italso  demonstrates  that a register/memorypair are still two individual registers ormemory locations  and  can  be  treated assuch.
   1  The  carry flag is not affected by eitherof these instructions.
   1  The  carry flag can be set to a "1"  withthe  instruction  SCF or Set  Carry  Flag.Although    there    are    no    specificinstructions  to  clear the carry flag  to"0"  there is an instruction to invert  itCCF or Compliment Carry Flag. We shall seelater that all logic instructions do clearthe carry flag.
   1  The  address in  the first  column is thelow   byte  address.  The  second   columndisplays   the   contents  of  the pair ofmemory locations as a single number.
   1  The  Z80 is  the microprocessor  at   theheart of your Spectrum.  This program willteach  you the use of all the instructionsavailable  on  the Z80,  in  a  series  ofsimple  progressive lessons.
   1  The   example  adds   together   the  twonumbers   8740  and  1260   using   singleregister addition only.  The double lengthnumbers are held in BC and DE so that  theresults  can  be  displayed  easily.  Thismethod of addition can be performed  usingregister  pair  addition, as well, to  addtogether numbers of any length.
   1  The    load   instruction   is   normallyabbreviated  to LD.  The simplest form  ofload  copies  data from  one  register  toanother, i.e. LD A,B  .
   1  THE ZERO FLAG
   1  Summary - zero and carry flags
   1  Summary - increment and decrement
   1  Summary - comparisons
   1  So far all instructions we have discussedthat  affect the Carry or Zero flags  alsoaffect the register concerned. There are anumber  of useful instructions  that  onlyaffect   flags.    The   compare   or   CPinstruction is one of these.
   1  Single and double register additions willobviously only give the correct result  ifthe answer is less than the maximum numberthe register(s) can hold. If it is greaterthan  this  a  carry  is  generated.   Theprocessor   holds   this  single  bit   ofinformation or flag, so that action can betaken over the occurrence of the carry. Ifthere  has  been  a  carry  on  the   lastarithmetic  operation the carry is said tobe set to a "1".  If not set it is said tobe a "0".
   1  Single  register subtraction takes  placewith the Accumulator. All the forms of ADDcan be used in subtract.  The abbreviationor  mnemonic SUB is always written withoutthe A,    which  is  implied.   Hence  theinstructions   are   SUB n,   SUB r,   andSUB (HL).  Again the result is held in theAccumulator.  The  carry flag is set to  a"1" if the result is outside the range  0-255.
   1  Since   double register  subtraction  canonly be performed with carry, the state ofthe  carry  flag  prior to  SBC HL,BC, andSBC HL,DE is important, and should be "0".
   1  Similarly, memory locations can be loadedindirectly  from any single register usingthe contents  of  the HL  register pair asaddress  i.e.  LD (HL),C.
   1  Similarly,  we can load the contents of aregister  pair  into  a  pair  of   memorylocations,   i.e.   LD (nn),BC   which  isequivalent    to    the    two   non-validinstructions  LD (nn),C  and  LD (nn+1),B. There   are  no   instructions  to   loadregister  pairs   with  the  contents   ofanother register pair. Two instructions inthe  form  LD r,r'  are  usually  used  toperform such an operation.
   1  Set Carry Flag
   1  SUMMARY - subtract with carry
   1  SUBTRACTION AND THE CARRY FLAG
   1  STORE DEFW 6000
   1  STORE DEFW 32000
   1  STORE DEFB 7
   1  STORE DEFB 6
   1  STORE DEFB 25
   1  SOURCE CODE   
   1  SIMPLE LOAD INSTRUCTIONS
   1  Return to operating system
   1  Remember, it is impossible for a  programto  destroy  your  computer. You'll need aa hammer to do that!
   1  Registers  are like pigeon holes in whichnumbers can be stored.  A single  registercan  store  any number between 0 and  255.The Z80 has many such registers. Initiallywe  shall consider only the  more  generalones:  designated A,B,C,D,E,H and L. The A( commonly called the Accumulator ) is themost  important,  since more  instructionsinvolve this register than any other.
   1  Register  pair  addition is performed  inconjunction with the HL register pair, andcan only involve BC or DE ( i.e. ADD HL,BCor ADD HL,DE ).  Again the result is  heldin  the  HL register pair,  and the  otherregister pair is unaffected.
   1  REGISTERS and MEMORY
   1  REGISTER PAIRS
   1  REGISTER PAIR EXAMPLES
   1  Program stopped. You may re-RUN, EDIT or press BREAK to return to menu.  
   1  Program has successfully assembled. Press RUN, EDIT, or exit by pressing BREAK. 
   1  Program counter has jumped to non-valid  address. EDIT or reRUN program.
   1  Proceed  through  the  menu  by  pressingENTER  to begin the highlighted lesson  orexample, and SPACE to jump to the next. Atanytime   BREAK  will  return you  to  themenu.
   1  Press SPACE to select and ENTER to start
   1  Press SPACE to continue.
   1  Press RUN to begin example, EDIT to edit, and BREAK to return to menu.
   1  Please confirm disk loading required  Y/N
   1  Perhaps a better description of load thanthe conventional one is copy, since a loadinstruction  copies the number held  in  aregister  or memory location into  anotherregister  or memory location.  As with allcopying the original remains unchanged.
   1  NUM2  DEFW 8740
   1  NUM1  DEFW 1260
   1  Loading lessons 26-35
   1  Loading lessons 18-25
   1  Loading lessons 10-17
   1  Loading lessons 1-9
   1  Loading has been stopped
   1  Loading error
   1  Load further lessons from disk
   1  Like  ADC instructions  SBC  instructionscan be  strung together to   subtract  anylength number.
   1  Lessons 1 - 9
   1  LOW   DEFB 20
   1  LOW   DEFB 0
   1  LD HL,NUM1
   1  LD HL,LOW
   1  LD HL,257
   1  LD HL,23040
   1  LD HL,(STORE)
   1  LD DE,8740
   1  LD DE,256
   1  LD A,(STORE)
   1  Just  as we can combine two registers  tohold  numbers up to 65535, we can  combineadjacent memory locations.  Conventionallythe  Low byte is held in the location withthe Lower address.
   1  It is  only affected by double   registerarithmetic operations involving the  carryflag,  i.e. only affected by ADC HL,dd  orSBC HL,dd.
   1  In  these   abbreviationed   instructions( mnemonics ),  it is conventional to  putthe register affected first,   followed bythe register from which the information iscopied.  Hence  LD A,B copies the contentsof B into A or Accumulator.
   1  If  n  is  the  number with  which  A  iscompared, then the following results :-
   1  INTRODUCTION TO RUNNING SIMULATOR
   1  INTRODUCTION
   1  INDIRECT ADDRESSING
   1  INC and DEC really only become useful  inconjunction   with   instructions   to  beintroduced shortly.
   1  HIGH  DEFB 125
   1  HIGH  DEFB 0
   1  Ex - zero flag
   1  Ex - single register addition
   1  Ex - simple load instructions
   1  Ex - register subtraction
   1  Ex - register pair subtraction
   1  Ex - register pair loading
   1  Ex - register pair addition
   1  Ex - indirect addressing
   1  Ex - inc and dec instructions
   1  Ex - comparison instructions
   1  EXAMPLES OF ZERO FLAG
   1  EXAMPLES OF INDIRECT ADDRESSING
   1  EXAMPLES OF COMPARE
   1  EXAMPLE OF REGISTER PAIR ADDITION
   1  EXAMPLE OF INCREMENT AND DECREMENT
   1  Disk V1.0 (c) HanSoft '85
   1  DEFM "  LD DE,22528
   1  DEFB is an  assembler  instruction  not aZ80   instruction.  The  allocated  memoryaddress is given in the first column.
   1  Compliment Carry Flag
   1  Compares A with register r
   1  Compares A with n ( 0 - 255)
   1  Colour  is used  to  illustrate  registerpair subtraction. Although ADC and SBC mayrequire the Carry flag to be cleared firstif the previous  calculation NEVER resultsin a carry being generated,  this step maybe omitted.  However it is often better tobe safe and include it,  than look for therandomly   occurring  fault  that  it  cangenerate.
   1  CP   compares  the  contents  of  the   Aregister  with  a number  (CP n),  anotherregister  (CP r),  or any memory  locationindirectly  addressed  through   the    HLregister  pair  ( CP (HL) ).  The  compareinstruction  is  effectively SUB  but  theresult does not affect the contents of theA register.
   1  Both  single  register and register  pairaddition are possible on the Z80.
   1  Before each  instruction is executed  theinstruction is described in ENGLISH.   Tryto  work  out what  should  happen  beforepressing   any   key   to   perform    theinstruction.
   1  BC, DE, and HL.
   1  At  present  the  programs  that  can  bewritten are somewhat limited.
   1  Another  very useful flag included in allprocessors is the Zero flag.  This flag isset to  "1"  if the result  of  any singleregister arithmetic   operation   is zero.Otherwise it is cleared to"0".
   1  Another    assembler    instruction    isintroduced,  the  DEFW  instruction.   Theassembler allocates 2  memory locations tothe associated label. The number after theDEFW sets the initial conditions.
   1  An  area of  memory that illustrates wellthe  use of  instructions  is  the screen.This area has the following addresses:-
   1  All single registers can be loaded  usingthe HL register pair as a pointer.
   1  All examples are run using the Simulator.At  this  stage  the  only  areas  of  thesimulator   screen  to  consider  are  theSource  Code ( the third column that holdsthe instructions )  and  the  area  at thebottom of the screen, which  displays  thecontents  of  the  registers.  Other areaswill be described as they are required.
   1  All  other  single  registers  cannot  beloaded  directly  from a memory  location.Such operations  require two  instructionsvia the A register.
   1  All   single   register   additions   areperformed with the Accumulator.  A  number(i.e. ADD A,6), the contents of a register(i.e. ADD A,B),  or  the  contents  of  anindirectly addressed memory location usingthe  HL  register  pair (i.e. ADD A,(HL) )can  be  added  to  the  Accumulator.  Theresult  is  held in the Accumulator.   Thesource of the addition is unaffected.
   1  ADDITIONS AND THE CARRY FLAG
   1  ADC  instructions can be strung  togetherto perform the addition of two numbers  ofany length, as the examples will show.
   1  A,B,C,D,E,H, or L.
   1  A second form of addition is available onthe Z80,  for  both  single  and  multipleregisters,   known   as  add  with  carry;abbreviated  to ADC.  They are similar  toADD  except that if the Carry flag is  setbefore   the   addition  the   result   isincremented   by   one.   All   previouslymentioned   ADD   instructions   can    beperformed as ADC.
   1  A  single  register can hold  0-255,  256different numbers. If we put two registersside by side,  such as HL,  the H registerholding  the High byte and the  L  holdingthe  Low  byte,  then we can hold  in  theregister  pair the number H*256+L*1 in thesame way as 27=2*10+7*1.  The maximum thatcan  be  held  in  a   register   pair  istherefore    255 * 256 + 255 = 65535.   Byconvention  the  high  byte  is  stored inthe  first  register in the register  pairname.
   1  9.  Compare
   1  8.  Zero Flag
   1  7.  Increment and Decrement
   1  6.  Subtraction and the Carry Flag
   1  5.  Addition and the Carry Flag
   1  4.  Indirect Addressing
   1  3.  Register Pairs
   1  22528 to 23295
   1  2.  Simple Load Instructions
   1  16384 to 22527
   1  1.  Registers and Memory
   1  . flag not affected
   1  )  SUBtract from A, n, r, or
   1  &    clears all  ENTER tabs to next line STOP  assembles   SPACE tabs in label are
   1   SUB (HL)
   1   SBC A,(HL)
   1   Loading error
   1   LD HL,HIGH
   1   LD HL,22550
   1   LD HL,22528
   1   LD HL,1000
   1   LD HL,(LOW)
   1   LD DE,NUM2
   1   LD DE,256
   1   LD DE,22528
   1   LD DE,(STORE)
   1   LD C,(HL)
   1   LD BC,32021
   1   LD BC,32
   1   LD BC,1260
   1   LD B,(HL)
   1   LD A,255
   1   LD A,(BC)
   1   LD A,(22530)
   1   LD (STORE),HL
   1   LD (STORE),DE
   1   LD (STORE),A
   1   LD (LOW),DE
   1   LD (HL),0
   1   LD (HIGH),A
   1   LD (BC),A
   1   Error  found  during  assembly. Please  correct before running program.
   1   EXAMPLE USING REGISTER PAIR SUBTRACTION
   1   EX DE,HL
   1   DEC (HL)
   1   After each lesson, step by step examplesare   given.   To  further  improve   yourunderstanding of the topic,  you may  thenmodify  or rewrite the examples,  and  runthem without fear of crashing the system.
   1   ADD HL,DE
   1   ADD A,230
   1   ADD A,(HL)
   1   ADC HL,HL
   1    Summary - loading register pairs
   1    INCREMENT AND DECREMENT INSTRUCTIONS
   1    EXAMPLE OF SINGLE REGISTER SUBTRACTION
   1    Detail area
   1    Colour area
   1    ASSEMBLED CODE   LABELS INSTRUCTIONS
   1     Summary - Loading single registers
   1     Summary -  indirect addressing
   1     Summary -  addition
   1     Enter the Z-80 simulator ?   Y/N  
   1     EXAMPLES OF SINGLE REGISTER ADDITION